package cn.initcap.concurrency.classloader;

/**
 * 如果注释了Sub类中的"public static int A = 4;"，接口与父类同时存在字段A，那编译器将提示"The field Sub.A is ambiguous"
 * <p>
 * 如果有一个同名字段同时出现在C的接口和父类中，或者同时在自己或父类的多个接口中出现，那编译器将可能拒绝编译
 *
 * @author initcap
 * @date Created in 2018/7/25 AM10:09.
 */
public class FieldResolution {

    public static void main(String[] args) {
        System.out.println(Sub.A);
    }

    interface Interface0 {
        int A = 0;
    }

    interface Interface1 extends Interface0 {
        int A = 1;
    }

    interface Interface2 {
        int A = 2;
    }

    static class Parent implements Interface1 {
        public static int A = 3;
    }

    static class Sub extends Parent implements Interface2 {
        public static int A = 4;
    }

}
